package com.prep;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.SystemClock;

public class OnBootReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context ctx, Intent nul) {
		setupAlarms(ctx);
	}

	public static void setupAlarms(Context ctx) {
		AlarmManager manager = (AlarmManager) ctx
				.getSystemService(Context.ALARM_SERVICE);
		PendingIntent pitent = PendingIntent.getBroadcast(ctx, 0, new Intent(
				ctx, CheckPackagesReceiver.class), (int) System
				.currentTimeMillis());

		manager.setRepeating(AlarmManager.ELAPSED_REALTIME,
				SystemClock.elapsedRealtime(), 5 * 1000, pitent);

	}
}
